package com.mallkit.core.business
{
	import com.adobe.cairngorm.business.ServiceLocator;
	
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.rpc.http.HTTPService;
	
	public final class MallkitMainServiceDelegate
	{
		 /**
	     *
	     * Defines a reference to the <code>IResponder<code> instance which
	     * handles the response of an asynchronous service invocation.
	     * 
	     */	
		private var responder:IResponder;
		
	    /**
	     *
	     * Defines a reference to the <code>AbstractService<code> object
	     * which is defined on the application <code>ServiceLocator</code>.
	     * 
	     */	
		private var service:HTTPService;
		
		public function MallkitMainServiceDelegate(responder:IResponder)
		{
			this.service = ServiceLocator.getInstance().getWebService("adyService");
			this.responder = responder;
		}
		
		public function test():void
		{
			var call:AsyncToken;
			var parameters:Object;
						
			// Set httpService parameters
			parameters = new Object();
			parameters.methodname = "getProductsRecentlyAdded";
			parameters.params = "<Int32>" + 5 + "</Int32>" + "<Int32>" + 1 + "</Int32>";
			call = service.send(parameters);
			call.addResponder(responder);
		}
	}
}